#ifndef XGE_XARCHIVE_H_
#define XGE_XARCHIVE_H_
#include "xge_common_config.h"
#include "xstring.h"
#include "xfile.h"
#include "xsmart_ptr.h"
#include "xallocator.h"
namespace xge{
  class Archive;
  class Dir;

  typedef xge_internal::SharedPtr<Archive,xge_internal::DefaultDestructor<Archive> > ArchivePtr;
  typedef xge::xge_internal::SharedPtr<Dir,xge::xge_internal::DefaultDestructor<Dir> > DirPtr;

  // A XArchive is not a file but a specific file container
  // You can access a certain archive by specifying FileSystem:\\ArchiveName
  // If it is a archive it will return the handle of this archive , the archive
  // handle have all the container information of this archive . Such as archive
  // and specific file
  class Archive: public Allocator {
  public:
    // Get a specific file handler by passing a file_path
    // this file path should be relative path to this archive
    // otherwise it will cause error .
    FilePtr LoadFile( const String& file_path ) {
      return LoadFile(file_path.c_str());
    }
    virtual FilePtr LoadFile( const char_t* path ) = 0 ;
    // Get a specific archive( Child Level ) by passing a file_path
    // this file path should be relative path to this archive
    // otherwise it will cause error .
    ArchivePtr LoadArchive( const String& file_path ) {
      return LoadArchive(file_path.c_str());
    } 
    virtual ArchivePtr LoadArchive( const char_t*  file_path ) = 0 ;

  public:
    // get the XDir begin to enumerate the file
    virtual DirPtr Begin() = 0;
  public:
    // the virtual archive dtor
    virtual ~Archive() {}
  };

}

#endif// XGE_XARCHIVE_H_